const Router = require('@koa/router');
const auth = require('../middleware/auth');

const router = new Router({
    prefix: '/api/v1'
});

// 公开测试路由
router.get('/public', async (ctx) => {
    ctx.body = {
        success: true,
        message: '这是一个公开的测试接口',
        data: {
            timestamp: new Date().toISOString()
        }
    };
});

// 受保护的测试路由
router.get('/private', auth, async (ctx) => {
    ctx.body = {
        success: true,
        message: '这是一个受保护的测试接口',
        data: {
            user: ctx.state.user,
            timestamp: new Date().toISOString()
        }
    };
});

module.exports = router;